import {SqliteDb} from "./sqliteDb.js";

export async function run(sql: string, params: string[]) {
	const db = new SqliteDb();
	// console.log(sql,params);
	return await db.run(sql, params).then((res) => {
		return res;
	});
}

export async function checkTable(tableName: string) {
	const db = new SqliteDb();
	return await db.table_exists(tableName).then((exists) => {
		return exists;
	});
}

export function close() {
	const db = new SqliteDb();
	return db.close();
}

export default {
	run,
	checkTable,
	close,
};
// const db = new SqliteDb;
// db.table_exists('lorem').then((exists) => {
// 	console.log('数据表lorem检查存在：',exists);
// });
// const sql = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
// const params = ['testSqlite'];
// db.run(sql,params);
